<!-- /snippets/site-nav.liquid -->
{% comment %}
  List out your main-menu linklist (default)

  More info on linklists:
    - http://docs.shopify.com/themes/liquid-variables/linklists
{% endcomment %}
<ul class="site-nav" id="AccessibleNav">
  {% for link in linklists.main-menu.links %}
    {% comment %}
      Create a dropdown menu by naming a linklist the same as a link in the parent nav

      More info on dropdowns:
        - http://docs.shopify.com/manual/your-website/navigation/create-drop-down-menu
    {% endcomment %}
    {% assign child_list_handle = link.title | handleize %}
    {% if linklists[child_list_handle].links != blank %}
      <li class="site-nav--has-dropdown{% if link.active %} site-nav--active{% endif %}" aria-haspopup="true">
        <a href="{{ link.url }}" class="site-nav__link">{{ link.title }}</a>
        <ul class="site-nav__dropdown">
          {% for childlink in linklists[child_list_handle].links %}
            <li{% if childlink.active %} class="site-nav--active"{% endif %}>
              <a href="{{ childlink.url }}" class="site-nav__link">{{ childlink.title | escape }}</a>
            </li>
          {% endfor %}
        </ul>
      </li>
    {% else %}
      <li {% if link.active %}class="site-nav--active"{% endif %}>
        <a href="{{ link.url }}" class="site-nav__link">{{ link.title }}</a>
      </li>
    {% endif %}
  {% endfor %}
</ul>
